<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
		
<ui:composition template="/_template.xhtml">
	<ui:define name="content">
	<div id="tree">
		<h:form>
			<p:tree value="#{treeBean.root}" var="doc" id="tree">
				<p:treeNode expandedIcon="ui-icon-folder-open"
					collapsedIcon="ui-icon-folder-collapsed">
					<h:outputText value="#{doc}" />
				</p:treeNode>

				<p:treeNode type="document" icon="ui-icon-document">
					<h:outputText value="#{doc}" />
				</p:treeNode>
			</p:tree>
		</h:form>
	</div>
	<div id="content">
		<h:form>
			<fieldset>
				<legend>Consultar Categoria</legend>
				<h:panelGrid columns="2">
					<h:outputText for="nome" value="Informe o Nome da Categoria: " />
					<p:inputText id="search-query" value="#{listaCategoriaBean.chave}" />
				</h:panelGrid>
				<p:commandButton ajax="false" id="pesquisar"  value="Pesquisar" action="#{listaCategoriaBean.pesquisar}" />

			</fieldset>
			<p:dataTable value="#{listaCategoriaBean.dataModel}" var="categoria"
				paginator="true" rows="5" dynamic="true">

				<p:column headerText="Nome">
					#{categoria.nome}
				</p:column>

				<p:column headerText="Descricao" resizable="false" >
					#{categoria.descricao}
				</p:column>

				<p:column headerText="Alterar">
					<h:commandLink action="#{categoriaBean.alterar(categoria)}"
						value="Alterar" />
				</p:column>

				<p:column headerText="Excluir">
					<h:commandLink action="#{listaCategoriaBean.deletarCategoria(categoria)}"
						value="Excluir" />
				</p:column>
				<!--  
				<p:column headerText="Excluir">
			
					<p:growl id="messages" />

					<h:outputText id="msg" value="#{listaCategoriaBean.message}" />

					<p:commandLink id="showDialogButton" value="Excluir"
						onclick="confirmation.show()" type="button" />

					<p:confirmDialog id="confirmDialog"
						message="Deseja realmente excluir?"
						header="Exclusão de categoria" severity="alert"
						widgetVar="confirmation">

						<p:commandButton id="confirm" value="Sim" update="messages"
							oncomplete="confirmation.hide()"
							action="#{listaCategoriaBean.deletarCategoria(categoria)}" />
						<p:commandButton id="decline" value="Não"
							onclick="confirmation.hide()" type="button" />

					</p:confirmDialog>

				</p:column>
				-->
			</p:dataTable>
			<p:messages id="messages" showDetail="true" autoUpdate="true" />
		</h:form>
	</div>
	</ui:define>
</ui:composition>
</html>